package com.heima.utils.thread;

import com.heima.model.wemedia.pojos.WmUser;

public class WmThreadLocalUtil {
    public static final ThreadLocal<WmUser> WM_THREAD_LOCAL = new ThreadLocal<>();

    /**
     * 向ThreadLocal中存入数据
     */
    public static void setUser(WmUser wmUser){
        WM_THREAD_LOCAL.set(wmUser);
    }

    /**
     * 从ThreadLocal中获取数据
     */
    public static WmUser getUser(){
        return WM_THREAD_LOCAL.get();
    }

    /**
     * 清除ThreadLocal中的数据
     */
    public static void clear(){
        WM_THREAD_LOCAL.remove();
    }
}
